﻿namespace GoodAdmin.System;

/// <summary>
/// 关联关系服务
/// </summary>
public interface IRelationService
{
    /// <summary>
    /// 存储关联关系，一对象，多目标
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="ObjectId"></param>
    /// <param name="TargetIds"></param>
    /// <returns></returns>
    Task AddRelation(string Category,long ObjectId,List<long> TargetIds, List<string> ExtraJson = null);

    /// <summary>
    /// 存储关联关系，一对象，一目标
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="ObjectId"></param>
    /// <param name="TargetIds"></param>
    /// <returns></returns>
    Task AddRelation(string Category, long ObjectId, long TargetId, string ExtraJson = null);

    /// <summary>
    /// 存储关联关系，一目标，多对象
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="TargetId"></param>
    /// <param name="ObjectIds"></param>
    /// <returns></returns>
    Task AddRelationByTargetId(string Category, long TargetId, List<long> ObjectIds, List<string> ExtraJson = null);

    /// <summary>
    /// 根据分类及对象id获取关联关系
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="ObjectId"></param>
    /// <returns></returns>
    Task<List<SysRelation>> GetRelationListByObjectId(string Category,long ObjectId);

    // <summary>
    /// 根据分类及对象id获取关联关系
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="ObjectIds"></param>
    /// <returns></returns>
    Task<List<SysRelation>> GetRelationListByObjectIdList(string Category, List<long> ObjectIds);
    /// <summary>
    /// 根据分类及目标id获取关联关系
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="targetId"></param>
    /// <returns></returns>
    Task<List<SysRelation>> GetRelationListByTargetId(string Category,long TargetId);

    /// <summary>
    /// 根据分类及目标id列表获取关联关系
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="TargetIds"></param>
    /// <returns></returns>
    Task<List<SysRelation>> GetRelationListByTargetId(string Category, List<long> TargetIds);
    /// <summary>
    /// 根据分类及对象id删除关联关系
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="ObjectId"></param>
    /// <returns></returns>
    Task DeleteRelationByCategoryAndObjectId(string Category, long ObjectId);
    /// <summary>
    /// 根据分类及对象id列表删除关联关系
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="ObjectId"></param>
    /// <returns></returns>
    Task DeleteRelationByCategoryAndObjectId(string Category, List<long> ObjectIds);

    /// <summary>
    /// 根据分类及目标id删除关联关系
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="TargetId"></param>
    /// <returns></returns>
    Task DeleteRelationByCategoryAndTargetId(string Category, long TargetId);

    /// <summary>
    /// 根据分类及对象id列表删除关联关系
    /// </summary>
    /// <param name="Category"></param>
    /// <param name="TargetIds"></param>
    /// <returns></returns>
    Task DeleteRelationByCategoryAndTargetId(string Category, List<long> TargetIds);



}
